﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.ReinforceLab.AudioModem.LinkLayer
{
    /// <summary>
    /// キャリア信号検出による波形を切り出す．
    /// 振幅が閾値(8e3)を超えたら，4サンプリングポイントだけ，有効とする
    /// </summary>
    /* class CDCFilter
    { 
        #region Variables
        const int carrierDetectionDuration = 16;
        const int peakThreshold = 5000;

        int _carrierDetection;
        #endregion

        #region Constructor
        public CDCFilter()
        {
            _carrierDetection = 0;
        }
        #endregion

        #region Public methods
        public int[] Filter(int[] waveform)
        {
            var demod_sig = new List<int>();
            foreach (var sig in waveform)
            {
                _carrierDetection--;
                if (sig > peakThreshold)
                    _carrierDetection = carrierDetectionDuration;

                if (_carrierDetection > 0)
                    demod_sig.Add(sig);
                else
                    demod_sig.Add(0);
            }
            return demod_sig.ToArray();
        }
        #endregion
    }
      */
}
